<!DOCTYPE html>
<html>
<head>
	<title>替换结点</title>
</head>
<body>

<div>
	<h1>1</h1>
	<h2>2</h2>
	<h3>3</h3>
	<h4>4</h4>
</div>

<script type="text/javascript">
	
// repaceChild(x1, x2)			x1新的元素， x2替换的元素

var div = document.getElementsByTagName('div')[0];
var h1 = div.children[0];
var h2 = div.children[1];
div.replaceChild(h2, h1);

</script>
</body>
</html>